<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <!-- a标签的跳转 改变 页面的 hash值 -->
    <a href="#/me">我的</a>
    <script>
        location.hash //获取url中 锚点 hash值 #aaa

        window.onhashchange//   地址栏中的hash值,发生改变就会触发.

        window.onhashchange = function () {
            console.log('hashchange');
            console.log(location.hash);//#/me
        }

        // window.addEventListener('hashchange', function () {
        //     console.log('hashchange');
        // })





    </script>

</body>

</html>